package com.hockeo.shared.rpc.command;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.hockeo.shared.rpc.command.error.CommandException;

/**
 * GWT/RPC command handler.
 *
 * @version $Id$
 * @author jjanke
 */
@RemoteServiceRelativePath( "command.rpc" )
public interface IRpcCommandService extends RemoteService
{
  /**
   * Executes the given command and returns the expected response.
   *
   * @param <T> the type of the expected response
   * @param strSessionId the ID of the client side session (checked on the server to avoid
   *          CSRF)
   * @param command the command to be executed remotely
   * @return the response
   * @throws CommandException if there was a server side processing failure
   */
  IResponse execute( String strSessionId, ICommand<?> command ) throws CommandException;
}
